﻿<cfsilent>
	<cfscript>

		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		jsonAdvice = getProperty("serviceFactory").getBean("jsonAdvice");
		response = structNew();
		
		structInsert(response, "success", false, true);

		teacherId = sessionAdvice.getAutherUserID();
		hashCode = event.getArg("Sign");
		
		chooserId = event.getArg("ChooseID");
		scroll = event.getArg("Mark");
		markMode = event.getArg("MarkMode");
		markNote = event.getArg("MarkNote");
		
			
			if ( decrypt(hashCode, teacherId, "PBEWithMD5AndDES", "Hex") eq chooserId ) {
				
				transaction {
				
					/* 根据成绩备注矫正分数 */
					if ( markNote eq "2" ) { /* 2 - 缺考 */ scroll = -1; }
					if ( markNote eq "9" ) { /* 9 - 违纪 */ scroll = -1; }
			
					
					
					/*更新临时成绩数据*/
					sql = "UPDATE
								t_temp_mark_resit
							SET
								mark_mode = :markMode,
								mark_renote = :markNote,
								mark_resit = :markResit 
							WHERE
								scc_id = :chooserId ";
								
					queryObj = new query( datasource=application.dnsMaster );
					
					queryObj.addParam( name="chooserId", value=chooserId, cfsqltype="cf_sql_varchar");
					queryObj.addParam( name="markMode", value=markMode, cfsqltype="cf_sql_char");
					queryObj.addParam( name="markNote", value=markNote, cfsqltype="cf_sql_char");
					queryObj.addParam( name="markResit", value=scroll, cfsqltype="cf_sql_decimal", scale=2 );
					
					queryObj.execute( sql=sql );
					

					structInsert(response, "success", true, true);
					structInsert( response, "ChooseID", chooserId );
					structInsert( response, "Mark", numberFormat(scroll, "_._") );

				}
				
			}
			else {
				structInsert(response, "reason", "验证数据失效", true);
			}
			
		

	</cfscript>
</cfsilent><cfoutput>#jsonAdvice.encode(data:response, stringNumbers:true)#</cfoutput>